# 设定模块名称
set(TARGET logger)

# 在src目录下搜集源码文件
aux_source_directory(src SOURCE_FILES)

# 将模块打包成静态库
add_library(${TARGET}
    STATIC
        ${SOURCE_FILES}
)

# 给模块起个别名，便与其他模块引用(原名的目标依然存在)
add_library(${PROJECT_NAME}::${TARGET} ALIAS ${TARGET})

# 根据构建类型，定义预编译宏
target_compile_definitions(${TARGET}
    PRIVATE
        RELEASED_LOG_FILE_PATH="/var/log/network_prober/daily.log"
)
message("生产环境的日志文件路径: RELEASED_LOG_FILE_PATH => /var/log/network_prober/daily.log")

# 将配置文件拷贝到/var/log/network_prober目录下
#install(
#    FILES "${CMAKE_CURRENT_SOURCE_DIR}/logs/daily.log"
#    DESTINATION "/var/log/${PROJECT_NAME}"
#    #    PERMISSIONS GROUP_READ
#    COMPONENT etc
#)

# 指定头文件
target_include_directories(${TARGET}
    PUBLIC
        include
)

# 为模块添加依赖
target_link_libraries(${TARGET}
    PUBLIC
        spdlog::spdlog
)

# 给模块增加预编译头文件
target_precompile_headers(${TARGET}
    PRIVATE
        ${PROJECT_INCLUDE_DIR}/pre_compiled.h
)